<?php 
@session_start();
	require_once('../execute/auth.php');	
	require_once('execute/inc/config.inc');
	
	?>
	<!doctype html>
<html>
	

<head>
	<title>TECHEDU Dashboard</title>
	<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no">
	<link rel="stylesheet" type="text/css" href="../css/bootstrap.css" />
	<link rel="stylesheet" type="text/css" href="../css/bootstrap-responsive.css" />
	<link rel="stylesheet" type="text/css" href="../css/style.css" />
	<link rel="stylesheet" href="../css/font-awesome.css" type="text/css">
	
	<script type="text/javascript" src="../js/jquery-1.8.0.min.js"></script>
	<script type="text/javascript" src="../js/main.js"></script>
	<script type="text/javascript" src="../js/bootstrap.js"></script>
	<script type="text/javascript" src="../js/bootstrap.file-input.js"></script>
	<script type="text/javascript" src="../js/chart.js"></script>
	<script type="text/javascript" src="../js/bootstrap-typeahead.js"></script>
	
	<!--[if lt IE 9]>
 <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
 <![endif]-->
 
  <script type = "text/javascript">
 
 $(function() {
	
	//call the function onload
	getdata( 1 );
});
 
function getdata( pageno ){
	
	var targetURL = '../pagination/search_results_admin.php?page=' + pageno;   

	$('#retrieved-data').html('<p><img src="pagination/ajax-loader.gif" /></p>');        
	$('#retrieved-data').load( targetURL ).hide().fadeIn('slow');
}      
</script>
</head>
<body>

	<div class="navbar navbar-fixed-top m-header">
		<div class="navbar-inner m-inner">
			<div class="container-fluid">
				<a class="brand m-brand" href="./index.html"><small>TECHNATION</small></a>
				
	 <form class="form-search m-search span5">
					<input type="text" placeholder="Type to search" class="span5 search-query">
				</form>
				<button type="button" class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
		 <span class="icon-bar"></span>
		 <span class="icon-bar"></span>
		 <span class="icon-bar"></span>
		 </button>
		 
				<div class="nav-collapse collapse">
					<div class="btn-group pull-right">
				 <a class="btn btn-inverse dropdown-toggle" data-toggle="dropdown" href="#">
			 		<i class="icon-user"></i> &nbsp;&nbsp;<?php echo $_SESSION['SESS_MEMBER_NAME'];?>
			 		<span class="caret"></span>
				 </a>
				 <ul class="dropdown-menu">
			 		<li><a href="#"><i class="icon-user"></i>&nbsp;Profile</a></li>
			 		<li><a href="#"><i class="icon-cog"></i>&nbsp;Settings</a></li>
	 		 				<li class="divider"></li>
			 		<li><a href="../execute/logout.php"><i class="icon-off"></i>&nbsp;Logout</a></li>
				 </ul>
			 	</div>
	 	</div>
			</div>
		</div>
	</div>
	<div class="m-top"></div>
	<aside class="sidebar">
		<ul class="nav nav-tabs nav-stacked">
			<li>
				<a href="index.php">
					<div>
						<div class="ico">
							<img src="../img/ico/ico-home.png">
						</div>
						<div class="title">
							Home
						</div>
					</div>
					<div class="arrow">
						<div class="bubble-arrow-border"></div>
						<div class="bubble-arrow"></div>
					</div>
				</a>
			</li>
			
			<li class="active">
				<a href="notification.html">
					
					<div>
						<div class="ico">
							<img src="../img/ico/news-icon.png">
						</div>
						<div class="title">
							News
						</div>
					</div>
					<div class="arrow">
						<div class="bubble-arrow-border"></div>
						<div class="bubble-arrow"></div>
					</div>
				</a>
			</li>
			
			<li class="">
				<a href="notification.html">
					
					<div>
						<div class="ico">
							<img src="../img/ico/ico-notification.png">
						</div>
						<div class="title">
							Courses
						</div>
					</div>
					<div class="arrow">
						<div class="bubble-arrow-border"></div>
						<div class="bubble-arrow"></div>
					</div>
				</a>
			</li>
			<li class="">
				<a href="form.html">
					<div>
						<div class="ico">
							<img src="../img/ico/ico-setting.gif">
						</div>
						<div class="title">
							Setting
						</div>
					</div>
					<div class="arrow">
						<div class="bubble-arrow-border"></div>
						<div class="bubble-arrow"></div>
					</div>
				</a>
			</li>
			<li class="">
				<a href="order.html">
					<div>
						<div class="ico">
							<img src="../img/ico/ico-order.gif">
						</div>
						<div class="title">
							Order
						</div>
					</div>
					<div class="arrow">
						<div class="bubble-arrow-border"></div>
						<div class="bubble-arrow"></div>
					</div>
				</a>
			</li>
			<li class="">
				<a href="media.html">
					<div>
						<div class="ico">
							<img src="../img/ico/ico-media.gif">
						</div>
						<div class="title">
							Media
						</div>
					</div>
					<div class="arrow">
						<div class="bubble-arrow-border"></div>
						<div class="bubble-arrow"></div>
					</div>
				</a>
			</li>
			<li class="">
				<a href="help.html">
					<div>
						<div class="ico">
							<img src="../img/ico/ico-help.gif">
						</div>
						<div class="title">
							Help
						</div>
					</div>
					<div class="arrow">
						<div class="bubble-arrow-border"></div>
						<div class="bubble-arrow"></div>
					</div>
				</a>
			</li>
			<li class="">
				<a href="#more">
					<div>
						<div class="ico">
							<img src="../img/ico/ico-user.gif">
						</div>
						<div class="title">
							User
						</div>
					</div>
					<div class="arrow">
						<div class="bubble-arrow-border"></div>
						<div class="bubble-arrow"></div>
					</div>
				</a>
			</li>
			<li class="">
				<a href="#more">
					<div>
						<div class="ico">
							<img src="../img/ico/ico-report.gif">
						</div>
						<div class="title">
							Report
						</div>
					</div>
					<div class="arrow">
						<div class="bubble-arrow-border"></div>
						<div class="bubble-arrow"></div>
					</div>
				</a>
			</li>
			<li class="">
				<a href="#" id="btn-more">
					<div>
						<div class="ico">
							<img src="../img/ico/ico-more.png">
						</div>
						<div class="title">
							More
						</div>
					</div>
				</a>
			</li>
	 </ul>
	</aside>
	<div class="m-sidebar-collapsed">
		<ul class="nav nav-pills">
			
		</ul>
		<div class="arrow-border">
			<div class="arrow-inner"></div>
		</div>
	</div>
	<div class="main-container">
		<div class="container-fluid">
			<section>
				<div class="page-header">
					<h1>News Module</h1>
				</div>
				<?php
	if(isset($_GET['r']) and $_GET['r']=="s"){
		?>
	
		<span class='span10 alert alert-success'>News has been Added!</span>
		<?php 
	}
	if(isset($_GET['r']) and $_GET['r']=="f"){
		
		?>
	<span class='alert alert-error'>Unable to Add news!</span>
		
		<?php
	
		
		
	}
?>
				<div id="fb-root"></div>

<div class="fb-comments" data-href="http://edu.technation.af" data-width="470" data-num-posts="10"></div>
				
				<div class="row-fluid">
					<div class="span4 m-widget">
						<div class="m-widget-header">
							<h4 class='text-info'><i class='icon-rss-sign'></i>&nbsp;Recent News</h4>
						</div>		
						<?php 
						$link = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD);
						if(!$link) {
							die('Failed to connect to server: ' . mysql_error());
						}
						
						//Select database
						$db = mysql_select_db(DB_DATABASE);
						if(!$db) {
							die("Unable to select database");
						}
						
						
						
						?>
						<div class="m-widget-body">
							<div id='retrieved-data'>
						   			<img src="images/ajax-loader.gif" />
						     </div>
						</div>
					</div>
					<div class="span8 m-widget">
						<div class="m-widget-header">
							<h3>Publish New</h3>
							
<form method="post" enctype="multipart/form-data" action="execute/update1_project.php">							
<div class="form-horizontal">
  <fieldset>
    <div class="control-group">
      <!-- Username -->
      <label class="control-label">Title</label>
      <div class="controls">
        <input type="text" id="new_title" name="new_title" placeholder="Title" class="input-xlarge">
        <p class="help-block">News Title</p>
      </div>
    </div>
 
    <div class="control-group">
      <!-- E-mail -->
      <label class="control-label">Category</label>
      <div class="controls">
        <input type="text" id='new_cat' name='new_cat' placeholder='Hit a Key' class="input-xlarge" id='cat' style="margin: 0 auto;" data-provide="typeahead" data-items="4" data-source="[&quot;Fellowship&quot;,&quot;Scholarship&quot;,&quot;Internship&quot;,&quot;Course&quot;,&quot;Seminar&quot;,&quot;CSS&quot;,&quot;HTML&quot;,&quot;JavaScript&quot;,&quot;Python&quot;,&quot;Ruby&quot;,&quot;Ruby on Rails&quot;,&quot;API&quot;,&quot;Other...&quot;]">
        <input type="hidden" id='user_id' name='user_id' value="<?php echo $_SESSION['SESS_USER_ID'];?>" >
        <input type="hidden" id='pub_date' name='pub_date' value="<?php echo date('Y-m-d');?>" >
        
        <p class="help-block">Please Select News Category</p>
      </div>
    </div>
 
    <div class="control-group">
      <!-- Password-->
      <label class="control-label" for="password">News Body</label>
      <div class="controls">
        <textarea rows="7" id='new_body' name='new_body' class='span10'></textarea>
        
      </div>

		</br>
      <div class="control-group">
      <label class="control-label" >Upload  image </label>
      <div class="controls">	
      
		<input type="file" name="photoimg" id="photoimg" />
		
		</br>
		
		</div>
		
		</div>
      
    </div>
 
   
 
    <div class="control-group">
      <!-- Button -->
      <div class="controls">
        <input type="submit" class="btn btn-success" id='add_news_btn' value="Publish"/>
      </div>
    </div>
  </fieldset>
</div>
</form>							
						</div>
						<div class="m-widget-body">
							<div class="row-fluid" id="updateResult">
											
							</div>
						</div>
					</div>
				</div>
				
			</section>
		</div>
	</div>
</body>
</html>